/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.palituxd.tools.swing;

import javax.swing.JTextField;

/**
 *
 * @author PPATOCHE
 */
public class CTextField extends JTextField {

    /**
     * Creates new form CTextField
     */
    public CTextField() {
        initComponents();
    }

    /**
     * Get the value of cantidadMaxCaracteres
     *
     * @return the value of cantidadMaxCaracteres
     */
    public int getCantidadMaxCaracteres() {
        return cantidadMaxCaracteres;
    }

    /**
     * Set the value of cantidadMaxCaracteres
     *
     * @param cantidadMaxCaracteres new value of cantidadMaxCaracteres
     */
    public void setCantidadMaxCaracteres(int cantidadMaxCaracteres) {
        this.cantidadMaxCaracteres = cantidadMaxCaracteres;
        procesar();
    }

    /**
     * Get the value of soloMayusculas
     *
     * @return the value of soloMayusculas
     */
    public boolean isSoloMayusculas() {
        return soloMayusculas;
    }

    /**
     * Set the value of soloMayusculas
     *
     * @param soloMayusculas new value of soloMayusculas
     */
    public void setSoloMayusculas(boolean soloMayusculas) {
        this.soloMayusculas = soloMayusculas;
        procesar();
    }

    /**
     * Get the value of soloNumeros
     *
     * @return the value of soloNumeros
     */
    public boolean isSoloNumeros() {
        return soloNumeros;
    }

    /**
     * Set the value of soloNumeros
     *
     * @param soloNumeros new value of soloNumeros
     */
    public void setSoloNumeros(boolean soloNumeros) {
        this.soloNumeros = soloNumeros;
        procesar();
    }
    
    private void procesar(){        
        this.setDocument(new TextoDocumento(cantidadMaxCaracteres, soloMayusculas, soloNumeros));        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    private int cantidadMaxCaracteres;
    private boolean soloMayusculas;
    private boolean soloNumeros;
}
